package leetcode.easy;

import leetcode.base.TreeNode;

/**
 * ClassName: $700_SearchBST
 * Description:
 * date: 2021-12-08 9:45
 *
 * @author liyifan
 */
public class $700_SearchBST {
    public TreeNode searchBST(TreeNode root, int val) {
        if (root == null)
            return null;
        if (val < root.val) {
            return searchBST(root.left, val);
        } else if(val > root.val) {
            return searchBST(root.right, val);
        } else {
            return root;
        }
    }
}
